package engine.scene.player
{
	import engine.flag.PlayerActionFlag;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.geom.Point;
	
	public class MoveAction extends Sprite implements IMove
	{
		/**
		 *	方向 
		 */		
		protected var _direction	:	int = 1;
		
		/**
		 *	状态 
		 */		
		protected var _status		:	String;
		
		/**
		 *	玩家模型 
		 */
		protected var _playerMovie	: 	MovieClip;
		
		public function get direction():int
		{
			return _direction;
		}
		
		public function set direction(value:int):void
		{
			_direction = value;
			
			if( null != _playerMovie )
			{
				_playerMovie.scaleX = _direction;
			}
		}
		
		public function get status():String
		{
			return _status;
		}
		
		public function set status(value:String):void
		{
			if( _playerMovie != null && _playerMovie.currentLabel == value ) return;
			
			if( value != null )
			{
				_status = value;
				
				updataStatus();
			}
		}
		
		protected function updataStatus():void
		{
			if( null != _playerMovie )
			{
				try
				{
					_playerMovie.gotoAndPlay( _status );
				}catch(e:Error){
				};
			}
		}
		
		public function get playerMovie():MovieClip
		{
			return _playerMovie;
		}
		
		public function move(xDistance:int, yDistance:int):void
		{
			x += xDistance;
			y += yDistance;
		}
		
		public function get point():Point
		{
			return new Point( x, y );
		}
		
		public function set point(value:Point):void
		{
			x = value.x;
			y = value.y;
		}
	}
}